import 'package:safetymonitor/app/core/core.dart';

///通用筛选样式
///centerContext 内容
///reset 重置
///confirm 确定
class CustomEndDrawer extends StatelessWidget {
  const CustomEndDrawer({
    required this.centerContext,
    required this.reset,
    required this.confirm,
    super.key,
  });

  final Widget? centerContext;

  final Function() reset;
  final Function() confirm;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: AppDimens.sw - 100.w,
      height: AppDimens.sh,
      padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 40.w),
      decoration: const BoxDecoration(
          gradient: LinearGradient(
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
        colors: [
          Color(0xFFE7EAFF),
          Color(0xFFFFFFFF),
          Color(0xFFFFFFFF),
        ],
      )),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Align(
            alignment: Alignment.centerLeft,
            child: Text(
              '筛选',
              style: TextStyle(
                fontSize: 18.sp,
                fontWeight: FontWeight.w500,
              ),
            ),
          ),
          AppGaps.vGap20,
          Expanded(
            child: centerContext ?? Container(),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              OutlinedButton(
                onPressed: reset,
                child: Text(
                  '重置',
                  style: TextStyle(fontSize: 16.sp, color: AppColors.font_color_blue),
                ),
              ),
              ElevatedButton(
                  style: ButtonStyle(backgroundColor: MaterialStateProperty.all(AppColors.font_color_blue)),
                  onPressed: confirm,
                  child: Text(
                    '确定',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 16.sp,
                    ),
                  )),
            ],
          )
        ],
      ),
    );
  }
}
